package com.woniuxy.rabbitmq83.publish;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * description: PublishProductor <br>
 * date: 2022/1/12 4:28 下午 <br>
 * author: shesaifei <br>
 * version: 1.0 <br>
 */
@Component
public class PublishProductor {
    @Resource
    private AmqpTemplate amqpTemplate;

    public void send(String message) {
        //将消息发送到指定的交换机上
        //参数1：交换机的名字
        //参数2：路由key
        //参数3：消息
        amqpTemplate.convertAndSend("fanoutExchange", "", message);
    }
}
